package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class RegistJPushApi extends BaseApi {

    RegistJPushReq req;

    public RegistJPushApi(String member_id, String jg_id, String app_key) {
        req = new RegistJPushReq(member_id, jg_id, app_key);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).registJPush(requestBody);
    }

    public class RegistJPushReq {

        public String member_id;
        public String jg_id;
        public String client_from;// 0-android 1-ios
        public String app_key;//

        public RegistJPushReq(String member_id, String jg_id, String app_key) {
            super();
            this.member_id = member_id;
            this.jg_id = jg_id;
            this.client_from = 0 + "";
            this.app_key = app_key;
        }
    }
}
